<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<c:set value="${c.module.moduleName}" var="moduleName" scope="request" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>修改${c.title}</title>
	</head>
	<body>
		<#list c.dictDeclares as d>
		<#if d.inGroup>
		<dict:dict type="${d.type}" var="${d.var}" />
		<script type="text/javascript">
var ${d.var} = eval('('+'<%=pageContext.getAttribute("${d.var}")%>'+')');
		</script>
		<#else>
		<dict:dict type="${d.type}" var="${d.var}" />
		</#if>
		</#list>
		<html:form action="/console/${c.module.moduleName}/${c.name?uncap_first}.do" styleId="${c.name?uncap_first}Form" method="POST">
			<input type="hidden" name="method" class="method" value="save" />
			<html:hidden property="id" />
			<table class="table-layout">
				<#assign trCount = 0>
				<#list c.properties as p>
			    <#assign trCount = trCount + 1>
				<tr class="<#if trCount%2 == 1>tr-odd<#else>tr-even</#if>">
					<td class="td-label">${p.element.title}</td>
					<td>
					<#if p.dict??>
						<#if p.isDictGroup()>
						<span id="${p.dictGroupGroup}Container_${p.dictGroupSerial}"> 
							<html:hidden property="${p.name}" /> 
							<select id="${p.dictGroupGroup}_${p.dictGroupSerial}"></select> 
						</span>
						<#else>
						<logic:iterate name="${p.dict}" id="entry">
							<html-el:radio property="${p.name}" value="${"$"}{entry.code}">
								<c:out value="${"$"}{entry.name}" />
							</html-el:radio>
						</logic:iterate>
						</#if>
					<#else>
						<html:text property="${p.name}" />
					</#if>
					</td>
				</tr>
				</#list>
		        <#list c.oneToOne as o>
		        <#if o.inverse == "false">
			    <#assign trCount = trCount + 1>
				<tr class="<#if trCount%2 == 1>tr-odd<#else>tr-even</#if>">
					<td class="td-label">
						${c.findClass(o.className,config).title}
					</td>
					<td>
						<table>
							<logic-el:iterate name="all${o.className}" id="${o.className?uncap_first}" indexId="index">
								<tr class="<c:if test="${"$"}{index % 2 == 0}">tr-odd</c:if><c:if test="${"$"}{index % 2 == 1}">tr-even</c:if>">
									<td>
										<html:radio idName="${o.className?uncap_first}" property="${o.refId}" value="id" />
									</td>
									<#list c.findClass(o.className,config).properties as p>
									<#if p.show == "true">
									<td>
										<c:out value="${"$"}{${o.className?uncap_first}.${p.name}}" />
										&nbsp;
									</td>
									</#if>
									</#list>
								</tr>
							</logic-el:iterate>
						</table>
					</td>
				</tr>
		        </#if>
		        </#list>
		        <#list c.manyToOne as o>
			    <#assign trCount = trCount + 1>
				<tr class="<#if trCount%2 == 1>tr-odd<#else>tr-even</#if>">
					<td class="td-label">
						${c.findClass(o.className,config).title}
					</td>
					<td>
						<table>
							<logic-el:iterate name="all${o.className}" id="${o.className?uncap_first}" indexId="index">
								<tr class="<c:if test="${"$"}{index % 2 == 0}">tr-odd</c:if><c:if test="${"$"}{index % 2 == 1}">tr-even</c:if>">
									<td>
										<html:radio idName="${o.className?uncap_first}" property="${o.refId}" value="id" />
									</td>
									<#list c.findClass(o.className,config).properties as p>
									<#if p.show == "true">
									<td>
										<c:out value="${"$"}{${o.className?uncap_first}.${p.name}}" />
										&nbsp;
									</td>
									</#if>
									</#list>
								</tr>
							</logic-el:iterate>
						</table>
					</td>
				</tr>
		        </#list>
			</table>
			<br />
			<div class="center-opertion">
				<html:submit>提交</html:submit>
				<html:cancel>取消</html:cancel>
			</div>
		</html:form>
		<#list c.dictGroups as d>
		<script type="text/javascript">
showDropDown(${d.var},[${d.properties}],"${d.group}");
		</script>
		</#list>
	</body>
</html>